﻿using System;
using System.Collections.Generic;
using System.Text;
using RS.DOM.Common;
using RS.DOM.Construction;

namespace RS.DOM.Types
{
    public class SubExpression : Token
    {
        public SubExpression(Context context, Expression result)
            : base(context, result)
        {
            base.Text = "Expression";
            base.TokenType = TokenType.SubExpression;
        }

        public override Token Resolve()
        {
            return this.Result.BuildAndExecute();
        }

        public Expression Result
        {
            get
            {
                return (Expression)base.Result;
            }
        }

        public override Token Create()
        {
            return new SubExpression(this.Context, this.Result.Copy()); ;
        }
    }
}
